package com.dinadi.yidi.http;

import com.zhy.http.okhttp.callback.FileCallBack;

import java.io.File;

import okhttp3.Call;

/**
 * Created by dell on 2016/3/21.
 */
public abstract class FileHttpCallback extends FileCallBack {


    public FileHttpCallback(String destFileDir, String destFileName) {
        super(destFileDir, destFileName);
    }

//    @Override
//                    public void inProgress(float progress, long total) {
////                        mProgressBar.setProgress((int) (100 * progress));
//                    }
//
//                    @Override
//                    public void onError(Call call, Exception e) {
//
//                    }
//
//                    @Override
//                    public void onResponse(File file) {
//
//
//                    }


    /**
     * 外部调用此方法进行数据处理
     *
     * @param response
     */
    public abstract void onSuccess(File response);

    public abstract void onFailure(String error);

    public abstract void onProgress(float progress, long total);



    @Override
    public void onResponse(File response) {
        //公用返回数据处理
        onSuccess(response);
    }

    @Override
    public void onError(Call call, Exception e) {
        onFailure(e.getMessage());
    }

    @Override
    public void inProgress(float progress, long total) {

        onProgress(progress, total);
    }
}
